let obj={username:"账号",password:"密码"}

export default  {
   
    numberOrLetter(rule, value, callback){
        const reg=/^[a-zA-Z0-9]{2,11}$/ 

        let name=rule.label

     
        
        if(value === "" ||value==null) 
        return  callback(new Error(`${name}不能为空!`))      
       
       if(value.length<2 || value.length>10) 
        return callback(new Error('长度只能在2-10位之间'))
       
       if( !(reg.test(value))) 
        return callback(new Error(`${name}只能为数字或者字母组成!`))

       
       return callback()
    },
    numberAndLetter(rule, value, callback){
        const reg = /(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9]).{3,11}/   

        let name=rule.label
        
        if(value === "" ||value==null) 
        return  callback(new Error(`${name}不能为空!`))      
       
       if(value.length<3 || value.length>10) 
        return callback(new Error('长度只能在3-10位之间'))

       if( !(reg.test(value))) 
       return callback(new Error(`${name}至少包含大小写字母和数字`))
       
       return callback()
    },
    examine(rule, value, callback){
      

        let name=rule.label
        let includeResult = rule.includeResult || []
        
        if(value === "" ||value==null) 
        return  callback(new Error(`${name}不能为空!`))      
       
       if(! includeResult.includes(value))
       return  callback(new Error(`请选择${name}!`))     

       return callback()
    }
}